home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / FWStream / Include / SLObjReg.idl < prev    next >
Encoding:
Text File  |  1996-08-16  |  2.7 KB  |  137 lines  |  [TEXT/MPS ]

  1. //
  2. //    File:        SLObjReg.idl
  3. //
  4. //    Contains:    Interface for OObjectRegistry class
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8.  
  9. #ifndef SLOBJREG_IDL
  10. #define SLOBJREG_IDL
  11.  
  12. #include <somobj.idl>
  13. #include <somcls.idl>
  14.  
  15. #ifndef SLSTDDEF_IDL
  16. #include "SLStdDef.idl"
  17. #endif
  18.  
  19.  
  20. //==============================================================================
  21. // Classes defined in this interface
  22. //==============================================================================
  23.  
  24. interface   FW_OObjectRegistry;
  25. interface   FW_OBasicObjectRegistry;
  26.  
  27.  
  28. //==============================================================================
  29. // Types defined by this interface
  30. //==============================================================================
  31.  
  32. #if defined(__SOMIDL__)
  33. #pragma somemittypes on
  34. #endif
  35.  
  36. typedef long FW_ObjectRegistry_ID;
  37. const FW_ObjectRegistry_ID FW_kNotInRegistry = -1;
  38.  
  39. #if defined(__SOMIDL__)
  40. #pragma somemittypes off
  41. #endif
  42.  
  43.  
  44. interface FW_OObjectRegistry : SOMObject
  45. {
  46.     
  47.     FW_ObjectRegistry_ID RegisterObject(in void *object);
  48.         // Register an object and returns the (unique) ID
  49.     
  50.     void RegisterObjectAndID(in void *object, in FW_ObjectRegistry_ID id);
  51.         // Register an object to particular id.
  52.         // The id must not already be in the registry.
  53.     
  54.     FW_ObjectRegistry_ID LookupByObject(in void *object);
  55.         // Look up an object in the registry, return FW_kNotInRegistry if object not found.
  56.  
  57.     void* LookupByID(in FW_ObjectRegistry_ID id);
  58.         // Find an object by ID, return its pointer.
  59.         // Return 0 if id not in registry.
  60.  
  61. #ifdef __SOMIDL__
  62.     implementation
  63.     {
  64.         functionprefix = "FW_OObjectRegistry__";
  65.  
  66.         override:
  67.             somInit,
  68.             somUninit;
  69.  
  70.         releaseorder:
  71.             somInit,
  72.             somUninit,
  73.  
  74.             RegisterObject,
  75.             RegisterObjectAndID,
  76.             LookupByObject,
  77.             LookupByID;
  78.  
  79.         majorversion = 1;
  80.         minorversion = 0;
  81.  
  82.         passthru C_xh =
  83.             "";
  84.  
  85.         passthru C_xih =
  86.             "";
  87.     };
  88. #endif
  89. };
  90.  
  91. //========================================================================================
  92. // FW_OBasicObjectRegistry
  93. //========================================================================================
  94.  
  95. interface FW_OBasicObjectRegistry : FW_OObjectRegistry
  96. {
  97.     struct SAssociation
  98.     {
  99.         FW_ObjectRegistry_ID    fID;            // object id
  100.         void*                    fObject;        // object address
  101.     };
  102.  
  103. #ifdef __SOMIDL__
  104.     implementation
  105.     {
  106.         functionprefix = "FW_OBasicObjectRegistry__";
  107.  
  108.         override:
  109.             somInit,
  110.             somUninit,
  111.  
  112.             RegisterObject,
  113.             RegisterObjectAndID,
  114.             LookupByObject,
  115.             LookupByID;
  116.  
  117.         majorversion = 1;
  118.         minorversion = 0;
  119.  
  120.         passthru C_xh =
  121.             "";
  122.  
  123.         passthru C_xih =
  124.             "";
  125.  
  126. #ifdef __PRIVATE__    
  127.         SAssociation*             fList;
  128.         long                    fListLength;
  129.         long                    fPhysicalListLength;
  130.         FW_ObjectRegistry_ID    fNextUnusedID;
  131. #endif
  132.     };
  133. #endif
  134. };
  135.  
  136. #endif
  137.